package com.tarena.util;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
/**
 * 编码解码工具类
 * @author Wangpeihu
 * @since 05/01/2010
 * @Team [Never give up]
 */
public class EncodingUtils {
	/**
	 * 
	 * @param str
	 * @return
	 * @throws UnsupportedEncodingException
	 */
	public static String enCoding(String str)
			throws UnsupportedEncodingException {
		String value = URLEncoder.encode(str, "utf-8");
		return value;
	}

	/**
	 * 
	 * @param str
	 * @return
	 * @throws UnsupportedEncodingException
	 */
	public static String deCoding(String str)
			throws UnsupportedEncodingException {
		String value = URLDecoder.decode(str, "utf-8");
		return value;
	}

}
